Page({
  validateForm(e){
    /*wx.setStorageSync('member', 12);
    wx.getStorage({
      key: 'member',
      success: function (res) {
        console.log(res.data);
       
      }
    })*/
    var member_phone = e.detail.value.member_phone;
    var member_password=e.detail.value.member_password;
    var reg = /^1[345789]\d{9}$/
    if (member_phone == "") {
      wx.showToast({
        title: '请输入手机号码',
        icon: 'none',
        duration: 1500
      });
    } else if (!reg.test(member_phone)) {
      wx.showToast({
        title: '手机号码格式错误',
        icon: 'none',
        duration: 1500
      });
    } else if (member_password==""){
      wx.showToast({
        title: '请输入密码',
        icon: 'none',
        duration: 1500
      });
    }else{
      wx.request({
        url: 'http://localhost/login',
        data: {
          "member_phone": member_phone,
          "member_password": member_password
        },
        type: "post",
        datatype: "json",
        success: function (data) {
          if (data.data != "登录成功") {
            wx.showToast({
              title:data.data,
              icon: 'none',
              duration: 1500
            });
          }else{
            wx.reLaunch({
              url: '../personalCenter/personalCenter',
            });
          }
        }
      });
    }
  }
});
